﻿  using System;
using System.IO;
using System.Collections.ObjectModel;
using System.Text;

using System.Xml;
using System.Xml.Serialization;
using cz.uhul.DSMLv2;
using cz.uhul.DSMLv2.Server.Sql;

namespace testDSML
{
  public class testRequest
  {

    public static void go()
    {

      LdRequestDocument rq = new LdRequestDocument()
      {
        AddRequests = new LdRequestsCollection()
        {
          new LdAddRequest()
          {
            DistinguishedName = "cn=smitkovar,cn=UHUL,cn=Users,o=mze,c=cz"
            ,Attributes = new cz.uhul.DSMLv2.LdAttrCollection()
            {
              new cz.uhul.DSMLv2.LdAttr()
              {
                Name = "objectClass"
                ,Values = new System.Collections.ObjectModel.ObservableCollection<string>()
                {
                  "eagriUzivatel"
                }
              }
              ,new cz.uhul.DSMLv2.LdAttr()
              {
                Name = "uid"
                ,Values = new System.Collections.ObjectModel.ObservableCollection<string>()
                {
                  "smitkovar"
                }
              }
              ,new cz.uhul.DSMLv2.LdAttr()
              {
                Name = "SN"
                ,Values = new System.Collections.ObjectModel.ObservableCollection<string>()
                {
                  "Smítková"
                }
              }
              ,new cz.uhul.DSMLv2.LdAttr()
              {
                Name = "GIVENNAME"
                ,Values = new System.Collections.ObjectModel.ObservableCollection<string>()
                {
                  "Radka"
                }
              }
              ,new cz.uhul.DSMLv2.LdAttr()
              {
                Name = "MAIL"
                ,Values = new System.Collections.ObjectModel.ObservableCollection<string>()
                {
                  "Smitkova.Radka@uhul.cz"
                }
              }
              ,new cz.uhul.DSMLv2.LdAttr()
              {
                Name = "MOBILE"
                ,Values = new System.Collections.ObjectModel.ObservableCollection<string>()
                {
                  null
                }
              }
              ,new cz.uhul.DSMLv2.LdAttr()
              {
                Name = "PROFESSIONDESC"
                ,Values = new System.Collections.ObjectModel.ObservableCollection<string>()
                {
                  null
                }
              }
              ,new cz.uhul.DSMLv2.LdAttr()
              {
                Name = "TELEPHONENUMBER"
                ,Values = new System.Collections.ObjectModel.ObservableCollection<string>()
                {
                  "371152415"
                }
              }
            }
          }
        }

      };

      Console.WriteLine(rq.ToXml().InnerXml.ToString());


      LdResponseDocument outP = LdRequestServerExtension.ProcessBatch(rq);

      Console.WriteLine(outP.ToXml().InnerXml.ToString());


    }






  }

}
